import 'package:flutter/material.dart';
import 'package:boxes_flutter/flutter/slc/res/theme_extension.dart';

///@author sunlunchang
class SlcStyles {
  //查看所端字体的默认颜色在[Typography]类中
  //全局主题
  //listView Item根据主题设置为白色或黑色时可考虑使用cardColor
  static ThemeData? _appTheme;
  static ThemeData? _appDarkTheme;

  static ThemeData _buildAppTheme({Brightness brightness = Brightness.light}) {
    //Color? hintColor = slcTidyUpColor.globalHintTextColorBlack;
    ThemeData appTheme = new ThemeData(
      useMaterial3: true,
      brightness: brightness,
      //colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),//更改主题颜色用这个
      //scaffoldBackgroundColor: SlcColors.colorBackground,
      extensions: getSlcThemeExtension(), /*hintColor: hintColor*/
    );
    return appTheme;
  }

  static ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
    switch (brightness) {
      case Brightness.light:
        return _appTheme ??= _buildAppTheme(brightness: brightness);
      case Brightness.dark:
        return _appDarkTheme ??= _buildAppTheme(brightness: brightness);
    }
  }

  static List<ThemeExtension<dynamic>> getSlcThemeExtension(){
    List<ThemeExtension<dynamic>> extension = List.empty(growable: true);
    SlcTidyUpColor slcTidyUpColor = getDefSlcTidyUpColor();
    extension.add(slcTidyUpColor);
    SlcListTileStyle slcListTileStyle = getDefListTileStyle();
    extension.add(slcListTileStyle);
    SlcTidyUpStyle slcTidyUpStyle = getDefSlcTidyUpStyle(slcTidyUpColor);
    extension.add(slcTidyUpStyle);
    return extension;
  }

  static SlcTidyUpColor getDefSlcTidyUpColor() {
  return SlcTidyUpColor();
  }

  static SlcListTileStyle getDefListTileStyle() {
  return SlcListTileStyle();
  }

  static SlcTidyUpStyle getDefSlcTidyUpStyle(SlcTidyUpColor slcTidyUpColor) {
  return SlcTidyUpStyle.fast(
  slcTidyUpColor.globalDividerColorBlack, slcTidyUpColor.globalDividerColorWhite);
  }
}
